/**
 * Copyright (C) 2025 pony working team
 * SPDX-License-Identifier: MulanPSL-2.0
 */

/* define to prevent recursive inclusion -------------------------------------*/
#ifndef __PONY_STM32_ERRNO_H__
#define __PONY_STM32_ERRNO_H__

/* includes (standard library, system) ---------------------------------------*/
/* includes (other library) --------------------------------------------------*/
/* includes (project) --------------------------------------------------------*/
/* includes (local) ----------------------------------------------------------*/

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/* defines -------------------------------------------------------------------*/

/* Common Error codes */
#define BSP_ERROR_NONE                  0
#define BSP_ERROR_NO_INIT               -1
#define BSP_ERROR_WRONG_PARAM           -2
#define BSP_ERROR_BUSY                  -3
#define BSP_ERROR_PERIPH_FAILURE        -4
#define BSP_ERROR_COMPONENT_FAILURE     -5
#define BSP_ERROR_UNKNOWN_FAILURE       -6
#define BSP_ERROR_UNKNOWN_COMPONENT     -7
#define BSP_ERROR_BUS_FAILURE           -8
#define BSP_ERROR_CLOCK_FAILURE         -9
#define BSP_ERROR_MSP_FAILURE           -10
#define BSP_ERROR_FEATURE_NOT_SUPPORTED -11

/* BSP OSPI error codes */
#define BSP_ERROR_OSPI_SUSPENDED          -20
#define BSP_ERROR_OSPI_MMP_UNLOCK_FAILURE -21
#define BSP_ERROR_OSPI_MMP_LOCK_FAILURE   -22

/* BSP HSPI error codes */
#define BSP_ERROR_HSPI_MMP_UNLOCK_FAILURE -31
#define BSP_ERROR_HSPI_MMP_LOCK_FAILURE   -32

/* BSP BUS error codes */
#define BSP_ERROR_BUS_TRANSACTION_FAILURE -100
#define BSP_ERROR_BUS_ARBITRATION_LOSS    -101
#define BSP_ERROR_BUS_ACKNOWLEDGE_FAILURE -102
#define BSP_ERROR_BUS_PROTOCOL_FAILURE    -103

#define BSP_ERROR_BUS_MODE_FAULT  -104
#define BSP_ERROR_BUS_FRAME_ERROR -105
#define BSP_ERROR_BUS_CRC_ERROR   -106
#define BSP_ERROR_BUS_DMA_FAILURE -107

/* typedefs ------------------------------------------------------------------*/
/* macro ---------------------------------------------------------------------*/
/* inlines -------------------------------------------------------------------*/
/* externs -------------------------------------------------------------------*/

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __PONY_STM32_ERRNO_H__ */
